<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2016/12/15
 * Time: 14:41
 */

class A {
	public static function get_self() {
		return new self();
	}

	public static function get_static() {
		return new static();
	}
	public function printOut(){
		echo __CLASS__;
	}
}

class B extends A {}

echo get_class(B::get_self()).PHP_EOL; // A
echo get_class(B::get_static()).PHP_EOL; // B
echo get_class(A::get_static()).PHP_EOL; // A

class Person
{
	public static function name()
	{
		echo "zrx".PHP_EOL;
	}
	public static function callself()
	{
		self::name();
	}

	public static function callstatic()
	{
		static::name();
	}
	public static function callselfClass()
	{
		return new self();
	}
	public static function callstaticClass()
	{
		return new static();
	}
}

class Man extends Person
{
	public static function name()
	{
		echo "响哥".PHP_EOL;
	}
}
Man::name();  // output： 响哥
Person::callself();  // output： zrx
Person::callstatic();  // output：zrx(子类调用 你懂的）
Man::callself();  // output：zrx(子类调用 你懂的）
Man::callstatic();  // output：响哥(子类调用 你懂的）
echo get_class(Man::callselfClass()).PHP_EOL;//Person
echo get_class(Man::callstaticClass()).PHP_EOL;//Man
echo get_class(Person::callselfClass()).PHP_EOL;//Person
echo get_class(Person::callstaticClass()).PHP_EOL;//Person


